home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / rexx / getxref.quill < prev    next >
Text File  |  1995-08-29  |  2KB  |  96 lines

  1. /**
  2.  **  VER$: GetXRef.te version 1.0 (13.7.94)
  3.  **  By Timothy J. Aston, modified by Osma Ahvenlampi
  4.  **  Based on GetXRef.ttx by David N. Junod
  5.  **
  6.  **  Display the AmigaGuide format Autodoc page for the word currently under
  7.  **  the cursor from within Quill.
  8.  **
  9.  **  Create a keystroke and/or menuitem and/or button macro with the following
  10.  **  command:
  11.  **    RX GetXRef.quill
  12.  **
  13.  **/
  14.           
  15. /* CONFIGURATION SECTION.
  16.  *
  17.  * The xref_file MUST be changed to reflect your set.
  18.  */
  19. xref_file = "Dev:Doc/AutoDoc.xref"
  20.  
  21. /**********************************************************
  22.  * Code section.  You should not have to modify any of this.
  23.  */
  24. options results
  25. options failat 255
  26.  
  27. main:
  28.     /* Add the library if its not already there.
  29.      */
  30.     IF ~show('L', 'amigaguide.library') then
  31.        call addlib('amigaguide.library', 0, -30)
  32.  
  33.     mode = 'SYNC'
  34.  
  35.     /* Get the name of the screen that TextEdit is being run on.
  36.      */
  37.     'GETATTR APPLICATION SCREEN VAR' screen
  38.  
  39.     /* Get the word currently under the cursor from TextEdit.
  40.      */
  41.     'GETWORD'
  42.     word = result
  43.  
  44.     /* See if the Autodoc cross-reference table is loaded, and if not, load it.
  45.      */
  46.     line = GetXRef("OpenWindow()")
  47.     if line = 10 then do
  48.         /* Show that we're doing something in the TextEdit status bar.
  49.          */
  50.         'SETSTATUSBAR' 'Loading cross-reference file...'
  51.  
  52.         /* The Autodoc table wasn't loaded, so load it.
  53.          */
  54.         LoadXRef(xref_file)
  55.     end
  56.  
  57.     /* See if the word is in the cross-reference table, and if not, we assume that
  58.      * the word we've been asked to look up is the name of a database.
  59.      */
  60.     function = word
  61.     xref = 0
  62.     line = GetXRef(function)
  63.     if line = 10 then do
  64.         /* Add the brackets to the name and try again.
  65.          */
  66.         function = word||"()"
  67.  
  68.         line = GetXRef(function)
  69.         if line = 10 then do
  70.             function = word
  71.         end
  72.         else do
  73.             xref = 1
  74.         end
  75.     end
  76.     else do
  77.         xref = 1
  78.     end
  79.  
  80.     /* Show that we're doing something in the TextEdit status bar.
  81.      */
  82.     'SETSTATUSBAR' 'Loading '||function||'...'
  83.  
  84.     /* See if we are trying to load a database or a document.
  85.      */
  86.     if xref = 0 then
  87.         ShowNode(screen, function'.guide', 'main', 1, 0)
  88.     else do
  89.         parse var line '"'doc'"' '"'database'"' linenum type
  90.         ShowNode(screen, database, doc, 1, 0)
  91.     end
  92.  
  93.     'SETSTATUSBAR' 'Done'
  94.  
  95.     exit
  96.